package com.sixth.controller;

import com.sixth.entity.Course;
import com.sixth.service.CourseService;
import com.sixth.until.CommonResult;
import com.sixth.until.TableResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: self-tui-education
 * @description:
 * @author: 老魏
 * @create: 2022-04-15 16:56
 **/
@RestController
@RequestMapping("core/course")
public class CourseController {
    @Autowired
    private CourseService courseService;
    //分页查询全部
    @PostMapping("/findCourse/{pageCurrent}/{pageSize}")
    public TableResult findCourse(@PathVariable Integer pageCurrent, @PathVariable Integer pageSize, @RequestBody Course course){
        return courseService.findCourse(pageCurrent,pageSize,course);
    }

    //更新上下架
    @PostMapping("/changeStatus")
    public CommonResult changeStatus(String id){
        return courseService.changeStatus(id);
    }

    //提交修改
    @PostMapping("/updateCourse")
    public CommonResult updateCourse(@RequestBody Course course){
        System.out.println(course);
        return courseService.updateCourse(course);
    }

    //前台课程中心 头部
    @PostMapping("/getAllMenu")
    public CommonResult getAllMenu(){
        return courseService.selectMenu();
    }
    //前台菜单
    @PostMapping("/fontFindCourse/{pageCurrent}/{pageSize}")
    public TableResult fontFindCourse(@PathVariable Integer pageCurrent, @PathVariable Integer pageSize, @RequestBody Course course){
        return  courseService.fontFindCourse(pageCurrent,pageSize,course);
    }

    //录播管理课程
    @PostMapping("/getCoursByTeacherPhone/{pageCurrent}/{pageSize}/{teacherMobile}/{checkStatus}")
    public TableResult getCoursByTeacherPhone(@PathVariable Integer pageCurrent, @PathVariable Integer pageSize,@PathVariable String teacherMobile,@PathVariable String checkStatus){
        return  courseService.getCoursByTeacherPhone(pageCurrent,pageSize,teacherMobile,checkStatus);
    }



}
